package nl.sanity.events
{
	import flash.events.Event;
	
	/**
	 * CustomEvent
	 * Custom event with often-used event types
	 * 
	 * @langversion ActionScript 3
	 * 
	 * @author M.P. Bartnig
	 * @since  28/03/2009
	 */
	public class CustomEvent extends Event
	{
		public static const CHANGE				:String 	= "change";
		public static const CLOSE				:String 	= "close";
		public static const FINISH				:String 	= "finish";
		public static const NAVIGATE			:String 	= "navigate";
		public static const NAVIGATE_BACKWARD	:String 	= "navigateBackward";
		public static const NAVIGATE_FORWARD	:String 	= "navigateForward";
		public static const ON_COMPLETE			:String 	= "onComplete";
		public static const ON_ERROR			:String 	= "onError";
		public static const RESET				:String 	= "reset";
		public static const SELECT				:String 	= "select";
		public static const SUBMIT				:String 	= "submit";
		public static const SUBSCRIBE			:String 	= "subscribe";
		public static const STATUS				:String 	= "status";

		protected var _data						:Object;
		
		// --- CONSTRUCTOR ----------------------------------------

		public function CustomEvent( type:String, data:Object, bubbles:Boolean=false, cancelable:Boolean=false )
		{
			_data = data;
			
			super( type, bubbles, cancelable );			
		}
		
		// --- OVERRIDE FUNCTIONS ----------------------------------------

		public override function clone():Event
		{
			return new CustomEvent( type, data, bubbles, cancelable );
		}
		
		// --- GETTERS/SETTERS ----------------------------------------

		public function get data():Object
		{
			return _data;
		}		
	}
}
	
	